Repository navigation
feat(nav3): [Part 9] Add the built-in SerialNameAndProperties mapper - #6706
Open
0xadam-brown wants to merge 6 commits into
Open
0xadam-brown wants to merge 6 commits into
0xadam-brown wants to merge 6 commits into
Conversation
This was referenced Nov 20, 2026
Contributor
|
4 of 9 tasks
📲 Install BuildsAndroid
|
This was referenced Nov 20, 2026
Contributor
PR risk: not classifiedFor commit The last run ended with status |
… the encoder The built-in SerialNameAndProperties mapper's compatibility probe treated only a LinkageError from the property encoder as conclusive; any other failure was inconclusive and property encoding proceeded anyway. An API-incompatible kotlinx.serialization version can fail the encoder without a LinkageError (for instance, a NullPointerException under R8), so the probe passed and the mapper went on to record wrong arguments. Now any failure of the encode probe disables property encoding and keeps names, since recording wrong arguments is worse than recording none.
… corruption
The property-encoding compatibility probe ran the encoder but ignored its output,
so a binary-incompatible kotlinx.serialization version that links and runs yet
mis-encodes under R8 (observed renaming {id=1} to {value=1} and dropping a route
as a duplicate key) passed the probe, and the mapper then recorded wrong
arguments.
The probe now compares the encoded ProbeClass fixture to its known-good output
and disables property encoding when they differ, keeping names. The mismatch
signal carries only a fixed message, never route data.
The encoding probe's broad catch passed LinkageErrors to ExceptionUtils.rethrowIfFatal, which rethrows them. The error then escaped the mapper's constructor, and BuiltInBackStackEntryMappers fell back to a mapper that records no names, instead of only disabling property encoding. The probe now returns a LinkageError before the fatal-error check, so an encoder that can't link keeps names and records encoding_failed, as other encoder failures do.
0xadam-brown
marked this pull request as ready for review
November 20, 2026 15:38
0xadam-brown
requested review from
runningcode
and removed request for
a team
November 20, 2026 15:38
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Stack (Nav3 Serial Name Mappers)
📜 Description
BackStackEntryMapper.SerialNameAndPropertieslets an application opt into recording serializable route properties alongside destination names. That gives navigation reports useful context without requiring a custom mapper for each route, while keeping the resulting arguments subject to the same back stack limits as custom output.Before collecting properties, the mapper checks that the app’s serialization runtime can encode a known fixture correctly. If the check throws or produces unexpected output, it disables property collection while continuing to record destination names. This avoids presenting incorrect arguments as useful route context.
A nonfatal property encoding failure preserves the destination's name and records why its arguments were dropped. This keeps navigation identity useful even when a particular route's diagnostic data cannot be represented.
💡 Motivation and Context
Let's host apps that want to serialize back stack entry names and properties easily do so.
addresses: JAVA-787 (link)
💚 How did you test it?
Nav3 release build and all 872 unit tests passed. Repository-wide
make format api, Spotless checks, ABI validation, and Detekt passed. The full suite also passed against serialization 1.13.0.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Continue with PR 10: Demonstrate the built-in mappers.